"use strict"

/**
 * 湖南省国家税务局采购网爬虫
 *  
 */

var Base = require("./base");
var hn_spider = new Base();
hn_spider.name = "湖南省国家税务局采购网";
hn_spider.page = 5;
hn_spider.encode="gbk";

hn_spider.getPageUrl = function (pg) {
    return "http://www.hntax.gov.cn/notice_list.jsp?smallclassid=20051108000028&pagenum=" + (pg-1);
    // if (pg == 1) {
    //     return "http://www.hntax.gov.cn/c18/index.html";
    // }
    // else {
    //     return "http://www.hntax.gov.cn/c18/pages/" + pg + ".html";
    // }
};

hn_spider.getItems = function ($) {
    var items = [];
    //$($("div.onelist.newslist ul li a")[0]).text()
    var jqObj = $("div.onelist.newslist ul li a");
    var td_length = jqObj.length;
    for (var i = 0; i < td_length; i++) {
        var item = {};
        item.title = $(jqObj[i]).text();
        item.url = $(jqObj[i]).attr("href");
        item.source = hn_spider.name;
        items.push(item);
    }
    return items;
};


exports = module.exports = hn_spider;